#pragma once

#include "ReadWriteLock.h"

class readLock
{
public:
    readLock(ReadWriteLock* p)
    {
        rwl = p;
        rwl->readLock();
    }
    ~readLock()
    {
        rwl->readUnlock();
    }
private:
    ReadWriteLock* rwl;
};

class writeLock
{
public:
    writeLock(ReadWriteLock* p)
    {
        rwl = p;
        rwl->writeLock();
    }
    ~writeLock()
    {
        rwl->writeUnLock();
    }
private:
    ReadWriteLock* rwl;
};